//
//  DXbarController.m
//  weibo
//
//  Created by DXapple on 16/1/5.
//  Copyright © 2016年 sqlite. All rights reserved.
//

#import "DXbarController.h"

@interface DXbarController ()

@end

@implementation DXbarController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    
    UITableViewController *homeCtrl = [[UITableViewController alloc]init];
    [self addChildViewController:homeCtrl adnImageName:@"tabbar_home" andTitle:@"首页"];
    UITableViewController *msgCtrl = [[UITableViewController alloc]init];
    [self addChildViewController:msgCtrl adnImageName:@"tabbar_message_center" andTitle:@"消息"];
    UITableViewController *discoverCtrl = [[UITableViewController alloc]init];
    [self addChildViewController:discoverCtrl adnImageName:@"tabbar_discover" andTitle:@"发现"];
    UITableViewController *profileCtrl = [[UITableViewController alloc]init];
    [self addChildViewController:profileCtrl adnImageName:@"tabbar_profile" andTitle:@"我"];
    
    


}
-(void)addChildViewController:(UIViewController *)childController adnImageName:(NSString *)imageName andTitle:(NSString *)title{
    
    childController.tabBarItem.image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];;
    
    childController.tabBarItem.selectedImage = [[UIImage imageNamed:[NSString stringWithFormat:@"%@_selected",imageName] ] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    childController.tabBarItem.title = title;
    
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    dict[NSForegroundColorAttributeName] = [UIColor orangeColor];
    [childController.tabBarItem setTitleTextAttributes:dict forState:UIControlStateSelected];
    NSLog(@"hahhah");

    [self addChildViewController:childController];
    
    
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
